﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using YAPL.Language.Ast;
using YAPL.Language.SourceParser.Helpers;
using YAPL.Language.SourceParser.Helpers;
using YAPL.Util;

namespace YAPL.Language.SourceParser.XML.NodeParsers {
	public class XmlConstantParser : XmlExpressionParser {
		public XmlConstantParser(XmlInputParser parser) : base(parser) {}
		public override Expression ParseNode(XElement node) {
			var valueAttribute = node.Attribute(XmlNames.ConstantValueAttribute);
			Require.NotNull(valueAttribute);

			return ConstantHelper.ParseConstant(valueAttribute.Value);
		}
	}
}
